package jmu.edu.yjc.domain.entity.neo4j.NodeEntity;

import io.swagger.annotations.ApiModel;
import jmu.edu.yjc.domain.entity.neo4j.RelationEntity.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.neo4j.core.schema.*;

import java.io.Serializable;
import java.util.Objects;
import java.util.List;

@Data
@Node("disease")
@NoArgsConstructor
@AllArgsConstructor
@Builder
@ApiModel("疾病")
public class Disease implements Serializable {
    @Id
    @GeneratedValue
    private Long id;
    @Property("name")
    private String name;
    @Property("desc")
    private String desc;
    @Property("prevent")
    private String prevent;
    @Property("cause")
    private String cause;
    @Property("easyGet")
    private String easyGet;
    @Property("cureLasttime")
    private String cureLasttime;
    @Property("cureDepartment")
    private String cureDepartment;
    @Property("cureWay")
    private String cureWay;
    @Property("curedProb")
    private String curedProb;
    @Property("getProb")
    private String getProb;
    @Relationship(type = "do_eat" , direction = Relationship.Direction.OUTGOING)
    private List<DoEat> doEat;
    @Relationship(type = "no_eat", direction = Relationship.Direction.OUTGOING)
    private List<NoEat> noEat;
    @Relationship(type = "recommend_food", direction = Relationship.Direction.OUTGOING)
    private List<RecommendEat> recommendEat;
    @Relationship(type = "recommend_drug" ,direction = Relationship.Direction.OUTGOING)
    private List<RecommendDrug> recommendDrug;
    @Relationship(type = "common_drug", direction = Relationship.Direction.OUTGOING)
    private List<CommonDrug> commonDrug;
    @Relationship(type = "need_check", direction = Relationship.Direction.OUTGOING)
    private List<NeedCheck> needCheck;
    @Relationship(type = "has_symptom", direction = Relationship.Direction.OUTGOING)
    private List<HasSymptom> hasSymptom;
    @Relationship(type = "complication_with", direction = Relationship.Direction.OUTGOING)
    private List<ComplicationWith> complicationWith;
    @Relationship(type = "belong_to", direction = Relationship.Direction.OUTGOING)
    private List<BelongsTo> belongsTo;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof Disease)) return false;
        Disease disease = (Disease) o;
        return Objects.equals(name, disease.name);
    }

    @Override
    public int hashCode() {
        return Objects.hash(name);
    }
}
